home *** CD-ROM | disk | FTP | other *** search
- unit ntc_ciel_client_form;
- {
- Copyright (C) 2004 - 2006 Andrew Sprott
-
- http://astronomy.crysania.co.uk
- astro@trefach.co.uk
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 2
- of the License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- }
-
- interface
-
- uses
- Windows,
- Messages,
- SysUtils,
- Classes,
- Graphics,
- Controls,
- Forms,
- Dialogs,
- ShellAPI,
- StdCtrls,
- Buttons,
- inifiles,
- ComCtrls,
- Menus,
- ExtCtrls,
- Mask,
- ScktComp,
-
- ntc_ciel_client_button;
-
- const
- { network }
- socket_number=8383;
- { messages }
- no_response='No response from server';
- lost_connection='lost connection with server';
- stop_error='NTC failed to stop the scope, '+
- 'it could be that there is a error '+
- 'or the network connection has failed';
- { events }
- event_0=0;
- { scope types }
- no_scope=0;
- lx200_type=1;
- autostar_type=2;
- { interface }
- button_width=57;
- max_menu_items=10;
-
- type
- p_dimensions_record=^dimensions_record;
- dimensions_record=record
- vdu_index,
- old_vdu_index,
- screen_left,
- screen_top,
- last_screen_height,
- last_screen_width,
- current_height,
- current_width,
- form_top,
- form_left:integer;
- end;
-
- Tscope = class(TForm)
- controller_pages: TPageControl;
-
- { constructors etc }
- procedure formcreate(
- Sender:TObject);
-
- procedure kill(
- Sender:TObject;
- var CanClose:Boolean);
-
- { configuration backup }
- procedure get_dimensions(
- form:tform;
- dimensions:p_dimensions_record;
- section:string;
- ini_file:tinifile);
-
- procedure write_dimensions(
- dimensions:p_dimensions_record;
- left,
- top:integer;
- section:string;
- ini_file:tinifile);
-
- procedure load_settings;
- procedure save_settings;
-
- { events }
- procedure control_button_click(
- Sender: TObject);
-
- procedure FormShow(
- Sender: TObject);
-
- procedure hide_ntc(
- Sender: TObject);
-
- procedure find_vdu(
- form:tform;
- dimensions:p_dimensions_record);
-
- procedure form_activate(
- form:tform;
- dimensions:p_dimensions_record);
-
- procedure check_activate(
- Sender: TObject);
-
- procedure change_page;
-
- procedure page_change(
- Sender: TObject);
-
- { menu item event handlers }
- procedure sticky_handler(
- sender:tobject);
-
- procedure buttonContextPopup(
- Sender: TObject;
- MousePos: TPoint;
- var Handled: Boolean);
-
- private
- { Private declarations }
- previous_page,
- current_page:ttabsheet;
- active_page:integer;
- { menu handling }
- menu_items:array[1..max_menu_items] of TMenuItem;
- context_menu:tpopupmenu;
- im:integer;
- { menu handler parameters }
- button:tscope_button;
-
- public
- { Public declarations }
- { configuration }
- dimensions:dimensions_record;
-
- { events }
- procedure show_hide(
- sender:tobject;
- v:boolean);
-
- end;
-
- { ------------------------
- Cartes du Ciel interface
- ------------------------ }
-
- Procedure ScopeShow; stdcall;
-
- Procedure ScopeShowModal(
- var ok:boolean); stdcall;
-
- Procedure ScopeConnect(
- var ok:boolean); stdcall;
-
- Procedure ScopeDisconnect(
- var ok:boolean); stdcall;
-
- Procedure ScopeGetInfo(
- var Name:shortstring;
- var QueryOK,
- SyncOK,
- GotoOK:boolean;
- var refreshrate:integer); stdcall;
-
- Procedure ScopeSetObs(
- la,
- lo:double); stdcall;
-
- Procedure ScopeAlign(
- source:string;
- ra,
- dec:double); stdcall;
-
- Procedure ScopeGetRaDec(
- var ar,
- de:double;
- var ok:boolean); stdcall;
-
- Procedure ScopeGetAltAz(
- var alt,
- az:double;
- var ok:boolean); stdcall;
-
- Procedure ScopeGoto(
- ar,
- de:double;
- var ok:boolean); stdcall;
-
- Procedure ScopeReset; stdcall;
-
- Function ScopeInitialized:boolean ; stdcall;
-
- Function ScopeConnected:boolean ; stdcall;
-
- Procedure ScopeClose; stdcall;
-
- procedure init_client;
-
- { ----------------
- global variables
- ---------------- }
-
- var
- scope:tscope;
- application_path:string;
- scope_type:word;
- { configuration }
- ini_file:tinifile;
- max_width:integer;
- ciel_closing:boolean;
-
- implementation
-
- uses
- ntc_ciel_client_network,
- ntc_ciel_client_control,
- ntc_ciel_client_info,
- ntc_ciel_client_focus,
- ntc_ciel_client_tracking,
- ntc_ciel_client_about,
- ntc_ciel_client_search,
- ntc_ciel_client_observer;
-
- {$R *.DFM}
-
- { ------------
- constructors
- ------------ }
-
- procedure tscope.formcreate(
- Sender:TObject);
- begin
- visible:=false;
- formstyle:=fsstayontop;
- ciel_closing:=false;
- application_path:=extractfilepath(paramstr(0));
- helpfile:=application_path+'\ntc.hlp';
- scope_type:=autostar_type;
- previous_page:=nil;
- load_settings;
- controller_pages.activepage:=current_page;
- end;
-
- procedure tscope.kill(
- Sender:TObject;
- var CanClose:Boolean);
- begin
- if ciel_closing then
- canclose:=true
- else
- canclose:=false;
- end;
-
- procedure init_client;
- begin
- Application.HelpFile:='ntc.hlp';
- Application.Title := 'NTC Client for Cartes du Ciel';
- scope.FormStyle:=fsNormal;
- end;
-
- { ------------------------
- Cartes Du Ciel interface
- ------------------------ }
-
- Procedure ScopeConnect(
- var ok:boolean); stdcall;
- begin
- ok:=scope_control.connect_to_scope;
- end;
-
- Procedure ScopeDisconnect(
- var ok:boolean); stdcall;
- begin
- scope.save_settings;
- ok:=scope_control.disconnect_from_scope;
- scope_network.kill;
- end;
-
- Procedure ScopeClose; stdcall;
- begin
- scope.save_settings;
- ciel_closing:=true;
- scope_control.release;
- scope_search.release;
- scope_focus.release;
- scope_tracking.release;
- scope_info.release;
- scope_network.release;
- scope_observer.release;
- scope_about.release;
- scope.release;
- end;
-
- Function ScopeConnected
- :boolean ; stdcall;
- begin
- result:=scope_network.connected;
- end;
-
- Function ScopeInitialized
- :boolean ; stdcall;
- begin
- result:=ScopeConnected;
- end;
-
- Procedure ScopeAlign(
- source:string;
- ra,
- dec:double); stdcall;
- begin
- scope_network.send_request_check(
- 'align'+'(ra='+floattostr(ra)+',dec='+floattostr(dec)+')');
- end;
-
- Procedure ScopeShowModal(
- var ok:boolean); stdcall;
- begin
- scope.showmodal;
- ok:=(scope.modalresult=mrOK);
- end;
-
- Procedure ScopeShow; stdcall;
- var
- current:ttabsheet;
- i:integer;
- begin
- current:=scope.current_page;
- with current do
- for i:=0 to controlcount-1 do
- with tscope_button(controls[i]) do
- if not button_hidden then
- case control_type of
- s_info:scope_info.show_form;
- s_about:scope_about.show_form;
- s_focus:scope_focus.show_form;
- s_network:scope_network.show_form;
- s_search:scope_search.show_form;
- s_control:scope_control.show_form;
- s_tracking:scope_tracking.show_form;
- s_observer:scope_observer.show_form;
- end;
- scope.show;
- end;
-
- Procedure ScopeGetRaDec(
- var ar,
- de:double;
- var ok:boolean); stdcall;
- begin
- if ScopeConnected then
- with scope_network do
- if (send_request_check('get_ra_dec')=[exit_ok]) and
- get_float('ra',ar) and
- get_float('dec',de) then
- ok:=true
- else
- ok:=false;
- end;
-
- Procedure ScopeGetAltAz(
- var alt,
- az:double;
- var ok:boolean); stdcall;
- begin
- if ScopeConnected then
- with scope_network do
- if (send_request_check('get_az_alt')=[exit_ok]) and
- get_float('az',az) and
- get_float('alt',alt) then
- ok:=true
- else
- ok:=false;
- end;
-
- Procedure ScopeGetInfo(
- var Name:shortstring;
- var QueryOK,
- SyncOK,
- GotoOK:boolean;
- var refreshrate:integer); stdcall;
- var
- s:string;
- begin
- queryok:=true;
- gotook:=false;
- syncok:=false;
- if scope=nil then
- scope:=Tscope.Create(nil);
- with scope_network,scope_control,scope_focus,scope_tracking do
- if (send_request_check('get_info')=[exit_ok]) and
- get_string('name',s) and
- get_boolean('can_goto',gotook) and
- get_boolean('can_sync',syncok) and
- get_boolean('can_focus',can_focus) and
- ((can_focus and get_integer('focus_speeds',focus_speeds)) or
- not can_focus) and
- get_boolean('can_track',can_track) then
- begin
- name:=shortstring(s);
- refreshrate:=scope_info.controller_timer.Interval;
- scope_name:=name;
- end
- else
- begin
- name:='';
- refreshrate:=500;
- scope_name:='unknown scope';
- end;
- end;
-
- Procedure ScopeReset; stdcall;
- begin
- end;
-
- Procedure ScopeSetObs(
- la,
- lo:double); stdcall;
- begin
- end;
-
- Procedure ScopeGoto(
- ar,
- de:double;
- var ok:boolean); stdcall;
- begin
- ok:=scope_network.send_request_check(
- 'goto_ra_dec'+'(ra='+floattostr(ar)+',dec='+floattostr(de)+')')>=[exit_ok];
- end;
-
- { --------------------
- configuration backup
- -------------------- }
-
- procedure tscope.hide_ntc(
- Sender: TObject);
- var
- current:ttabsheet;
- i:integer;
- begin
- current:=scope.current_page;
- with current do
- for i:=0 to controlcount-1 do
- with tscope_button(controls[i]) do
- if not button_hidden then
- case control_type of
- s_info:scope_info.hide_form;
- s_about:scope_about.hide_form;
- s_focus:scope_focus.hide_form;
- s_network:scope_network.hide_form;
- s_search:scope_search.hide_form;
- s_control:scope_control.hide_form;
- s_tracking:scope_tracking.hide_form;
- s_observer:scope_observer.hide_form;
- end;
- scope.Hide;
- end;
-
- procedure Tscope.find_vdu(
- form:tform;
- dimensions:p_dimensions_record);
- var
- i,lw,lh:integer;
- done,vdu_changed:boolean;
-
- procedure switch_monitor;
- begin
- with dimensions^,screen.monitors[vdu_index] do
- begin
- if screen_left<0 then
- begin
- if form_left>=0 then
- form_left:=form_left+screen_left+left
- else
- form_left:=abs(form_left-screen_left)+left;
- end
- else
- form_left:=form_left-screen_left+left;
- if screen_top<0 then
- begin
- if form_top>=0 then
- form_top:=form_top+screen_top+top
- else
- form_top:=abs(form_top-screen_top)+top;
- end
- else
- form_top:=form_top-screen_top+top;
- screen_left:=left;
- screen_top:=top;
- end;
- end;
-
- begin
- with screen,dimensions^ do
- begin
- vdu_changed:=false;
- if vdu_index>=0 then
- begin
- i:=0;
- if (old_vdu_index>=0) and (old_vdu_index<monitorcount) then
- begin
- if old_vdu_index<>vdu_index then
- begin
- vdu_index:=old_vdu_index;
- switch_monitor;
- end;
- old_vdu_index:=-1;
- end;
- done:=false;
- while not done do
- if i<monitorcount then
- with monitors[i] do
- begin
- if (form_left<left) or
- (form_left>left+width) or
- (form_top<top) or
- (form_top>top+height) then
- inc(i)
- else
- begin
- if i<>vdu_index then
- vdu_index:=i;
- done:=true;
- end;
- end
- else
- begin
- done:=true;
- vdu_changed:=true;
- vdu_index:=-1;
- end;
- end;
- if vdu_index<0 then
- begin
- i:=0;
- while (i<monitorcount) and not monitors[i].Primary do
- inc(i);
- if i<monitorcount then
- vdu_index:=i
- else
- vdu_index:=0;
- vdu_changed:=true;
- end;
- with monitors[vdu_index] do
- begin
- if vdu_changed then
- switch_monitor;
- lw:=current_width;
- lh:=current_height;
- if (lw<>width) or (lh<>height) then
- begin
- current_width:=width;
- current_height:=height;
- form_left:=trunc(form_left/last_screen_width*current_width);
- if form_left+form.width>left+current_width then
- form_left:=left+current_width-form.Width;
- if form_left<left then
- form_left:=left;
- form_top:=trunc(form_top/last_screen_height*current_height);
- if form_top+form.height>top+current_height then
- form_top:=top+current_height-form.height;
- if form_top<top then
- form_top:=top;
- last_screen_width:=current_width;
- last_screen_height:=current_height;
- end
- else
- begin
- current_width:=width;
- current_height:=height;
- end;
- end;
- end;
- end;
-
- procedure tscope.get_dimensions(
- form:tform;
- dimensions:p_dimensions_record;
- section:string;
- ini_file:tinifile);
- begin
- with ini_file,dimensions^ do
- begin
- vdu_index:=readinteger(section,'monitor',-1);
- old_vdu_index:=readinteger(section,'another_monitor',-1);
- form_top:=readinteger(section,'top',form_top);
- form_left:=readinteger(section,'left',form_left);
- screen_left:=readinteger(section,'screen_left',0);
- screen_top:=readinteger(section,'screen_top',0);
- last_screen_width:=readinteger(section,'screen_width',-1);
- current_width:=last_screen_width;
- last_screen_height:=readinteger(section,'screen_height',-1);
- current_height:=last_screen_height;
- find_vdu(form,dimensions);
- end;
- end;
-
- procedure tscope.write_dimensions(
- dimensions:p_dimensions_record;
- left,
- top:integer;
- section:string;
- ini_file:tinifile);
- var
- i:integer;
- begin
- with ini_file,screen,dimensions^ do
- begin
- for i:=0 to monitorcount-1 do
- if monitors[i].primary and (vdu_index<>i) then
- old_vdu_index:=vdu_index;
- writeinteger(section,'another_monitor',old_vdu_index);
- writeinteger(section,'monitor',vdu_index);
- writeinteger(section,'left',left);
- writeinteger(section,'top',top);
- writeinteger(section,'screen_width',current_width);
- writeinteger(section,'screen_height',current_height);
- writeinteger(section,'screen_left',monitors[vdu_index].left);
- writeinteger(section,'screen_top',monitors[vdu_index].top);
- end;
- end;
-
- procedure tscope.load_settings;
- var
- l,m,ip,ib,t:integer;
- p,b,bn:string;
- pd,bd,h,s:boolean;
- ts:ttabsheet;
-
- procedure add_control_page(
- page_name:string);
- begin
- with controller_pages do
- begin
- ts:=ttabsheet.create(self);
- with ts do
- begin
- pagecontrol:=controller_pages;
- caption:=page_name;
- l:=0;
- end;
- end;
- end;
-
- procedure add_button(
- scope_control_object:scope_button_type;
- button_name:string;
- hidden,
- stuck:boolean);
- begin
- with ts,tscope_button.create(ts) do
- begin
- visible:=false;
- caption:=button_name;
- left:=l;
- width:=button_width;
- inc(l,button_width);
- if l>m then
- m:=l;
- top:=0;
- height:=25;
- parent:=ts;
- button_hidden:=hidden;
- if button_hidden then
- button_stuck:=false
- else
- begin
- button_stuck:=stuck;
- if stuck then
- font.style:=[fsbold]
- else
- font.style:=[];
- end;
- control_type:=scope_control_object;
- onclick:=control_button_click;
- oncontextpopup:=buttonContextPopup;
- visible:=true;
- end;
- end;
-
- procedure add_hide_button;
- begin
- with ts,tscope_button.create(ts) do
- begin
- visible:=false;
- caption:='Hide';
- left:=l;
- width:=button_width;
- inc(l,button_width);
- if l>m then
- m:=l;
- top:=0;
- height:=25;
- parent:=ts;
- font.style:=[];
- onclick:=hide_ntc;
- visible:=true;
- end;
- end;
-
- procedure add_menu(
- i:integer;
- s:string;
- h:tnotifyevent);
- begin
- if im>max_menu_items then
- scope_network.write_status_log_check('too many menus : '+inttostr(im))
- else
- begin
- menu_items[im]:=nil;
- menu_items[im]:=tmenuitem.create(self);
- with menu_items[im] do
- begin
- caption:=s;
- checked:=false;
- onclick:=h;
- end;
- context_menu.items.add(menu_items[im]);
- end;
- inc(im);
- end;
-
- begin
- ini_file:=tinifile.create(application_path+'ciel.ini');
- scope_type:=ini_file.ReadInteger('main','scope_type',autostar_type);
- { menus }
- context_menu:=tpopupmenu.create(self);
- im:=1;
- add_menu(im,'Sticky Control',sticky_handler);
- { control panel }
- m:=0;
- current_page:=nil;
- with controller_pages,ini_file do
- if readinteger('main','num_control_panels',0)>0 then
- begin
- active_page:=readinteger('main','active_page',0);
- ip:=1;
- pd:=false;
- while not pd do
- begin
- p:=readstring('main','panel_'+inttostr(ip),'');
- if p<>'' then
- begin
- add_control_page(p);
- if active_page=ip then
- current_page:=ts;
- p:='panel_'+inttostr(ip);
- ib:=1;
- bd:=false;
- while not bd do
- begin
- b:='button_'+inttostr(ib)+'_';
- bn:=readstring(p,b+'name','');
- if bn<>'' then
- begin
- t:=readinteger(p,b+'module',0);
- h:=readbool(p,b+'hidden',true);
- s:=readbool(p,b+'stuck',false);
- if t>0 then
- begin
- case t of
- s_info:add_button(s_info,bn,h,s);
- s_focus:add_button(s_focus,bn,h,s);
- s_about:add_button(s_about,bn,h,s);
- s_object:add_button(s_object,bn,h,s);
- s_search:add_button(s_search,bn,h,s);
- s_control:add_button(s_control,bn,h,s);
- s_network:add_button(s_network,bn,h,s);
- s_tracking:add_button(s_tracking,bn,h,s);
- s_observer:add_button(s_observer,bn,h,s);
- end;
- end;
- end
- else
- bd:=true;
- inc(ib);
- end;
- add_hide_button;
- end
- else
- pd:=true;
- inc(ip);
- end;
- if current_page=nil then
- begin
- current_page:=controller_pages.activepage;
- active_page:=controller_pages.ActivePageIndex+1;
- end
- else
- controller_pages.activepage:=current_page;
- end
- else
- begin
- add_control_page('Setup');
- add_button(s_about,'About',true,false);
- add_button(s_network,'Network',true,false);
- add_button(s_observer,'Location',true,false);
- add_hide_button;
- add_control_page('Control');
- add_button(s_info,'Info',true,false);
- add_button(s_focus,'Focus',true,false);
- add_button(s_search,'Search',true,false);
- add_button(s_control,'Control',true,false);
- add_button(s_tracking,'Track',true,false);
- add_hide_button;
- current_page:=controller_pages.ActivePage;
- active_page:=controller_pages.ActivePageIndex+1;
- end;
- max_width:=m;
- { form }
- get_dimensions(scope,@dimensions,'main',ini_file);
- ini_file.Free;
- end;
-
- procedure tscope.save_settings;
- var
- i,j:integer;
- ps,bs:string;
- begin
- ini_file:=tinifile.create(application_path+'ciel.ini');
- scope_network.save_settings;
- scope_control.save_settings;
- scope_focus.save_settings;
- scope_info.save_settings;
- scope_tracking.save_settings;
- scope_search.save_settings;
- scope_observer.save_settings;
- scope_about.save_settings;
- with ini_file do
- begin
- { control panel }
- with controller_pages do
- begin
- for i:=0 to pagecount-1 do
- begin
- ps:='panel_'+inttostr(i+1);
- writestring('main',ps,pages[i].caption);
- for j:=0 to pages[i].ControlCount-1 do
- with pages[i],tscope_button(Controls[j]) do
- begin
- bs:='button_'+inttostr(j+1)+'_';
- WriteString(ps,bs+'name',caption);
- writestring(ps,bs+'module',inttostr(control_type));
- writebool(ps,bs+'hidden',button_hidden);
- writebool(ps,bs+'stuck',button_stuck);
- end;
- end;
- writestring('main','num_control_panels',inttostr(pagecount));
- end;
- writeinteger('main','active_page',active_page);
- { form }
- find_vdu(scope,@dimensions);
- write_dimensions(@dimensions,left,top,'main',ini_file);
- end;
- ini_file.free;
- end;
-
- { ------
- events
- ------ }
-
- procedure Tscope.FormShow(
- Sender: TObject);
- begin
- with dimensions do
- begin
- top:=form_top;
- left:=form_left;
- clientwidth:=max_width;
- end;
- change_page;
- end;
-
- procedure Tscope.form_activate(
- form:tform;
- dimensions:p_dimensions_record);
- var
- w,h:integer;
- begin
- with form,dimensions^ do
- begin
- find_vdu(form,dimensions);
- w:=screen.monitors[vdu_index].width;
- h:=screen.monitors[vdu_index].Height;
- if (w<>current_width) or
- (h<>current_height) then
- begin
- last_screen_width:=current_width;
- last_screen_height:=current_height;
- current_width:=w;
- current_height:=h;
- scope_network.adjust;
- scope_control.adjust;
- scope_about.adjust;
- scope_focus.adjust;
- scope_info.adjust;
- scope_observer.adjust;
- scope_tracking.adjust;
- scope_search.adjust;
- form_top:=trunc(form_top/last_screen_height*current_height);
- form_left:=trunc(form_left/last_screen_width*current_width);
- top:=form_top;
- left:=form_left;
- scope.show;
- end;
- end;
- end;
-
- procedure Tscope.check_activate(
- Sender: TObject);
- begin
- form_activate(scope,@dimensions);
- end;
-
- procedure Tscope.show_hide(
- sender:tobject;
- v:boolean);
- begin
- with tscope_button(sender) do
- if not v then
- begin
- if button_stuck then
- font.style:=[];
- button_stuck:=false;
- button_hidden:=true;
- end
- else
- button_hidden:=false;
- end;
-
- procedure Tscope.control_button_click(
- Sender: TObject);
- begin
- with tscope_button(sender) do
- begin
- case control_type of
- s_info:scope_info.check_visible_and_show_hide(sender);
- s_focus:scope_focus.check_visible_and_show_hide(sender);
- s_about:scope_about.check_visible_and_show_hide(sender);
- s_network:scope_network.check_visible_and_show_hide(sender);
- s_search:scope_search.check_visible_and_show_hide(sender);
- s_control:scope_control.check_visible_and_show_hide(sender);
- s_tracking:scope_tracking.check_visible_and_show_hide(sender);
- s_observer:scope_observer.check_visible_and_show_hide(sender);
- end;
- end;
- end;
-
- procedure tscope.change_page;
- var
- i:integer;
- begin
- previous_page:=current_page;
- if previous_page<>nil then
- with previous_page do
- for i:=0 to controlcount-1 do
- with tscope_button(controls[i]) do
- begin
- if not button_stuck then
- case control_type of
- s_info:scope_info.hide_form;
- s_about:scope_about.hide_form;
- s_focus:scope_focus.hide_form;
- s_network:scope_network.hide_form;
- s_search:scope_search.hide_form;
- s_control:scope_control.hide_form;
- s_tracking:scope_tracking.hide_form;
- s_observer:scope_observer.hide_form;
- end;
- end;
- current_page:=controller_pages.ActivePage;
- with current_page do
- for i:=0 to controlcount-1 do
- with tscope_button(controls[i]) do
- begin
- if not button_hidden then
- case control_type of
- s_info:scope_info.show_form;
- s_about:scope_about.show_form;
- s_focus:scope_focus.show_form;
- s_network:scope_network.show_form;
- s_search:scope_search.show_form;
- s_control:scope_control.show_form;
- s_tracking:scope_tracking.show_form;
- s_observer:scope_observer.show_form;
- end;
- end;
- active_page:=controller_pages.ActivePageIndex+1;
- end;
-
- procedure Tscope.page_change(
- Sender: TObject);
- begin
- change_page;
- end;
-
- { -------------------
- menu event handlers
- ------------------- }
-
- { menu handlers }
- procedure tscope.sticky_handler(
- sender:tobject);
- begin
- with tmenuitem(sender) do
- begin
- with button do
- begin
- button_stuck:=not button_stuck;
- if button_stuck then
- font.Style:=[fsbold]
- else
- font.style:=[];
- end;
- end;
- end;
-
- procedure tscope.buttonContextPopup(
- Sender: TObject;
- MousePos: TPoint;
- var Handled: Boolean);
- begin
- { setup up parameters }
- button:=sender as tscope_button;
- { call popup menu }
- handled:=true;
- with button do
- context_menu.popup(
- scope.left+current_page.left+parent.left+left+mousepos.x,
- scope.top+current_page.top+parent.top+top+mousepos.y);
- end;
-
- end.
-